#pragma once

#include <vector>

#include <tuple>

#include "Marker.h"
#include "GameBoard.h"

using namespace TUMAR::MarkerTracking;

namespace TUMAR { namespace CountryRoads {
	
	class MarkerEnvironment
	{
	private:
		MarkerContainer markers;

		std::map<int, Marker*> lookup;

		std::vector<const Marker*> outOfBoardMarkers;
		
		std::vector<std::tuple<const Marker*, int, int>> inBoardMarkers;

		double scale;
		
		bool CalcMarkerPositionInGameBoard(const Marker* marker, int boardWidth, int boardHeight);
	public:
		// board marker ids
		int BoardPositionMarkerId;
		int BoardScaleMarkerId;

		// user marker ids
		int UserMarkerRoadStraightId; // make this a vector, if we have more than one player
		int UserMarkerRoadCurveId; // make this a vector, if we have more than one player 
		

		double dx, dy, dz;

		MarkerEnvironment(void);
		~MarkerEnvironment(void);

		const Marker* GetBoardPositionMarker(void) const;
		const Marker* GetBoardScaleMarker(void) const;

		bool IsBoardVisible(void) const;

		double GetBoardScale() const;
		
		const std::vector<const Marker*>& GetOutOfBoardMarkers(void) const;

		const std::vector<std::tuple<const Marker*, int, int>>& GetInBoardMarkers(void) const;
		
		TileType GetTileType(const Marker* marker) const;

		void Update(const MarkerContainer& markers, int boardWidth, int boardHeight);
	};

}}